package com.atguigu.gmall0701.demo.customer.controller;

import com.atguigu.gmall0701.demo.customer.bean.Customer;
import org.springframework.web.bind.annotation.*;

@RestController
public class CustomerController {
    //接收请求路径中键值对的参数（查询条件，辅助参数） 用于读 浏览器可见
    // 路径中嵌入的参数（主键唯一标识） 用于读 浏览器可见
    @RequestMapping("/customer/{id}.html")
    @GetMapping("/customer/{id}.html")
    public String getCustomer(@PathVariable("id") String id, @RequestParam("name") String name, @RequestParam("age") Integer age) {
        return "hello world!  name : " + name + "  age : " + age + " id : " + id;


    }

    //post
    //接收表单方式提交
    @PostMapping("/customer")
    public String saveCustomer(@RequestBody  Customer customer) {
        System.out.println("保存客户信息： " + customer.toString());
        return "success";
    }


}
